<template>
  <div>
    <!-- <div class="item_title">
      <div>《</div>
      <div>{{ movieObj.nm }}</div>
      <div></div>
    </div> -->
    <header1>{{ movieObj.nm }}</header1>
    <div class="item_two">
        <img src="	https://p0.meituan.net/scarlett/448afce485c1f342895185c2be668fa411803.png" alt="">
        <span>19.9元起购票</span>
        <div>打开APP></div>
    </div>
    <div class="itemcon">
      <div class="one"><img :src="movieObj.img" alt="" /></div>
      <div class="two1">
          <div class="o1">{{movieObj.nm}}</div>
          <div class="o2">{{movieObj.enm}}</div>
          <div class="o3">
              <span>{{movieObj.wish}}</span>
              <span>人想看</span>
          </div>
          <div>
              <span class="o2">{{movieObj.cat}}</span>
          </div>
          <div class="o2">{{movieObj.src}}/{{movieObj.episodeDur}}分钟</div>
          <div class="o2">{{movieObj.pubDesc}}</div>
      </div>
      <div class="o2">》</div>
    </div>
    <div class="date-list">
         <ul>
            <li
          v-for="(item, index) in dateArr"
          :key="item.date"
          @click="getCinemaData(item.date, index)"
          :class="index == activeid ? 'active' : ''"
        >
          {{ item.date | format(index) }}
            </li>
      </ul>
    </div>
    <div v-for='item in cinemaArr' :key='item.id' class="conlist">
        <div class="list1">
            <div>{{item.nm}}</div>
            <div>{{item.price}}<span class="aa">元起</span></div>
        </div>
        
            <div class="list2">{{item.addr}}</div>
            <div class="list3">
                <div>退</div>
                <div>改签</div>
                <div>小吃</div>
                <div>折扣卡</div>
            </div>
            <div class="list4">{{item.promotion.cardPromotionTag}}</div>
            <div class="list5">近期场次：{{item.showTimes}}</div>
        
    </div>
    <!-- <div class="show_warp">
        <div class="show_days">
            <div>今天{{dateArr[0].date}}</div>
            <div>明天{{dateArr[1].date}}</div>
            <div>后天{{dateArr[2].date}}</div>
            <div>周日{{dateArr[3].date}}</div>
            <div>周一{{dateArr[4].date}}</div>
            <div>周二{{dateArr[5].date}}</div>
            <div>周三{{dateArr[6].date}}</div>
            <div>周四{{dateArr[7].date}}</div>
            <div>周六{{dateArr[8].date}}</div>
        </div> 
    </div>  -->
  </div>
</template>

<script>
import axios from "axios";
import header1 from "@/components/commonh/header1"
export default {
  name: "item",
  data: function () {
    return {
      movieObj: {}, 
      dateArr: [], 
      cinemaArr:[],
      id:0,
      activeid:0
    };
  },
   filters: {
      format(value,index){
          var arr=value.split('-')
          var str=''
          var jintian=['今天','明天','后天']
          if(index<3){
              str+=jintian[index]
          }else{
              str+=`周${"日一二三四五六".charAt(new Date(value).getDay())}`
          }
          str+=`${arr[1]}月${arr[2]}日`
          return str
        },
   },
  methods: {
    
    getCinemaData(date,index) {
        this.activeid=index
        this.getData(date)
    },
    getData(date){
        axios.get( "/api/mtrade/mmcs/cinema/v1/select/movie/cinemas.json?limit=20&offset=0&utm_term=7.5&client=iphone&channelId=4&areaId=-1&brandId=-1&districtId=-1&hallType=-1&lineId=-1&movieId=" 
            +this.id +"&serviceId=-1&stationId=-1&showDate=" +date+"&cityId=30&ci=30").then((res)=>{
                console.log(res);
                this.cinemaArr=res.data.data.cinemas
        })
    }
  },
  mounted() {
    
    this.id = this.$route.params.id;
    axios.get("/api/mtrade/mmdb/movie/v5/" + this.id + ".json").then((res) => {
    
      this.movieObj = res.data.data.movie;
      this.movieObj.img = this.movieObj.img.replace("w.h", "110.150");
    });

    axios
      .get(
        "/api/mtrade/mmcs/show/v1/movie/showdays.json?movieId=" +
          this.id +
          "&channelId=4&cityId=30"
      )
      .then((res) => {
        this.dateArr = res.data.data.dates;
        this.getData(this.dateArr[0].date)
      });
  },
  components: {
    header1
}
 
};

</script>

<style scoped>
.list5{
    margin-top: 5px;
    color: #999; margin-top: 4px;
        font-size: 12px;
}
.list1 :nth-of-type(1){
    line-height: 23px;
    font-size: 16px;
    color: #000;
}
.list1 :nth-of-type(2){
    color:#f03d37;
}
.list1 .aa{
    font-size: 12px;
    color: #f03d37;
}
.list3{
    font-size: 12px;
    display: flex;
}
.list3 div{
    margin-right: 5px;
    text-align: center;
}
.list3 :nth-of-type(1){
    width: 20px;height: 17px;
    border: 1px solid #589daf;
    color: #589daf
}
.list3 :nth-of-type(2){
    width: 32px;height: 17px;
    border: 1px solid #589daf;
    color: #589daf;
}
.list3 :nth-of-type(3){
    width: 32px;height: 17px;
    color: #f90;border: 1px solid #f90;
}
.list3 :nth-of-type(4){
    width: 44px;height: 17px;
    color: #f90;border: 1px solid #f90;
    
}
.list4{color: #999; margin-top: 4px;
        font-size: 12px;}
.conlist{
    width: 360px;
    height: 143px;
    border-bottom: 1px solid grey;
    margin: 0 auto;
    /* display: flex;
    flex-wrap: wrap;
    align-content: space-around; */
}
.list1{
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}
.list2{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 5px;
    font-size: 13px;
    color: #666;
}
.date-list {
  width: 100%;
  height: 45px;
  border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc; 
  overflow: scroll;
}
.date-list ul {
  width: 1200px;
  display: flex;
}
.date-list ul li {
  width: 130px;
  height: 45px;
  line-height: 45px;
  text-align: center;
}
.show_warp{
    height: 45px;
    width: 100%;
    overflow-x:scroll ;
}
.show_days{
    position: relative;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    width: 1100px;
    height: 45px;
    background-color: #fff;
    overflow-x: auto;
    z-index: 11;
    align-items: center;
}
.show_days div{
    width: 150px;
    font-size: 14px;
    margin-right: 2px;
}
.o1{
    font-size: 20px;
    font-weight: 700;
    color:white;
}
.o2{
    font-size: 12px;
    color:white;
}
.o3{
    font-size: 18px;
    font-weight: 700;
    color: #fc0;
}
.two1{
    width: 174px;
    height: 150px;
    /* display: flex;
    flex-wrap: wrap; */
}
.two1>div{
    margin-bottom: 5px;
}
.itemcon{
    display: flex;
    background: rgb(97, 69, 69);
    width: 100%;
    height: 188px;
    align-items: center;
    justify-content: space-around;
}
.con1921{
    font-size: 12px;
    width: 200px;

    height: 158px;
}

.item_two{
    widows: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-around;
}
.item_two span{
    font-size: 12px;
    font-weight: 400;
    color: #666;
}
.item_two div{
    font-weight: 700;
    font-size: 14px;
    color: #b37e7e;
}
.item_two img{
    width: 94px;
    height: 39px;
}
.item_title {
  width: 100%;
  height: 50px;
  line-height: 50px;
  background: #e54848;
  display: flex;
  justify-content: space-around;
  color: white;
}
.item_title div:nth-of-type(1),
.item_title div:nth-of-type(3) {
  width: 15%;
  text-align: center;
}
.item_title div:nth-of-type(2) {
  width: 70%;
  text-align: center;
}
</style>